home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Toolbox / Visual Basic Toolbox (P.I.E.)(1996).ISO / toolkit / riruf1 / rufdemo.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-05-19  |  9.5 KB  |  298 lines

  1. VERSION 2.00
  2. Begin Form RUFMain 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   1  'Fixed Single
  5.    ClientHeight    =   5385
  6.    ClientLeft      =   1065
  7.    ClientTop       =   1395
  8.    ClientWidth     =   7455
  9.    Height          =   6075
  10.    Icon            =   RUFDEMO.FRX:0000
  11.    Left            =   1005
  12.    LinkTopic       =   "Form1"
  13.    MaxButton       =   0   'False
  14.    ScaleHeight     =   5385
  15.    ScaleWidth      =   7455
  16.    Top             =   765
  17.    Width           =   7575
  18.    Begin SSFrame Frame3D2 
  19.       Font3D          =   0  'None
  20.       ForeColor       =   &H00000000&
  21.       Height          =   3975
  22.       Left            =   120
  23.       TabIndex        =   2
  24.       Top             =   1320
  25.       Width           =   7215
  26.       Begin Label lblInfo 
  27.          BackColor       =   &H00C0C0C0&
  28.          Caption         =   "Information"
  29.          ForeColor       =   &H00FF0000&
  30.          Height          =   3615
  31.          Left            =   120
  32.          TabIndex        =   3
  33.          Top             =   240
  34.          Width           =   6975
  35.       End
  36.    End
  37.    Begin SSFrame Frame3D1 
  38.       Font3D          =   0  'None
  39.       ForeColor       =   &H00000000&
  40.       Height          =   1215
  41.       Left            =   120
  42.       TabIndex        =   1
  43.       Top             =   0
  44.       Width           =   7215
  45.       Begin Label lblTitle 
  46.          Alignment       =   2  'Center
  47.          BackColor       =   &H00C0C0C0&
  48.          Caption         =   "MIS Resources International, Inc"
  49.          FontBold        =   -1  'True
  50.          FontItalic      =   0   'False
  51.          FontName        =   "Arial"
  52.          FontSize        =   18
  53.          FontStrikethru  =   0   'False
  54.          FontUnderline   =   0   'False
  55.          ForeColor       =   &H00000080&
  56.          Height          =   975
  57.          Left            =   120
  58.          TabIndex        =   0
  59.          Top             =   120
  60.          Width           =   6975
  61.       End
  62.    End
  63.    Begin Menu mainMenu 
  64.       Caption         =   "&File"
  65.       Index           =   1
  66.       Begin Menu fileMenu 
  67.          Caption         =   "&Logon..."
  68.          Index           =   1
  69.       End
  70.       Begin Menu fileMenu 
  71.          Caption         =   "&Compact Database"
  72.          Index           =   2
  73.       End
  74.       Begin Menu fileMenu 
  75.          Caption         =   "&Select Database..."
  76.          Index           =   3
  77.       End
  78.       Begin Menu fileMenu 
  79.          Caption         =   "E&xit"
  80.          Index           =   4
  81.       End
  82.    End
  83.    Begin Menu mainMenu 
  84.       Caption         =   "&Data"
  85.       Index           =   2
  86.       Begin Menu dataMenu 
  87.          Caption         =   "&Employee Data..."
  88.          Index           =   1
  89.       End
  90.       Begin Menu dataMenu 
  91.          Caption         =   "Employee &Statuses..."
  92.          Index           =   2
  93.       End
  94.    End
  95.    Begin Menu mainMenu 
  96.       Caption         =   "&Send Mail"
  97.       Index           =   3
  98.       Visible         =   0   'False
  99.    End
  100.    Begin Menu mainMenu 
  101.       Caption         =   "&Help"
  102.       Index           =   4
  103.       Begin Menu helpMenu 
  104.          Caption         =   "&Help Contents"
  105.          Index           =   1
  106.          Shortcut        =   {F1}
  107.       End
  108.       Begin Menu helpMenu 
  109.          Caption         =   "&Search For Help On..."
  110.          Index           =   2
  111.       End
  112.       Begin Menu helpMenu 
  113.          Caption         =   "&About..."
  114.          Index           =   3
  115.       End
  116.       Begin Menu helpMenu 
  117.          Caption         =   "&Shareware Version"
  118.          Checked         =   -1  'True
  119.          Index           =   4
  120.       End
  121.       Begin Menu helpMenu 
  122.          Caption         =   "&Other Features"
  123.          Index           =   5
  124.       End
  125.    End
  126. Option Explicit
  127. 'menu constants
  128. Const MCLOGON% = 1
  129. Const MCCOMPACT% = 2
  130. Const MCDATABASE% = 3
  131. Const MCEXIT% = 4
  132. Const MCCONTENTS% = 1
  133. Const MCSEARCHHELP% = 2
  134. Const MCABOUT% = 3
  135. Const MCSWV% = 4
  136. Const MCOTHER% = 5
  137. Const MCEMPLOYEES% = 1
  138. Const MCEMPSTATUS% = 2
  139. Function CheckPassword% ()
  140.     On Error GoTo passErr
  141.     Dim sTmp$
  142.     HourglassCursor
  143.     'lookup the users password here
  144.     sTmp = "RUF"
  145.     'here we compare; passwords are case insensitive
  146.     If StrComp(sTmp, sPassword, 1) = 0 Then
  147.         sPassword = sTmp
  148.         CheckPassword = True
  149.     Else
  150.         CheckPassword = False
  151.     End If
  152.     ArrowCursor
  153.     Exit Function
  154. passErr:
  155.     ArrowCursor
  156.     GetErrorMsg Err
  157.     Exit Function
  158. End Function
  159. Sub dataMenu_Click (Index As Integer)
  160.     Select Case Index
  161.         Case MCEMPLOYEES
  162.             lblInfo.Caption = LoadText("empform.txt")
  163.             ModalForm Empform
  164.         Case MCEMPSTATUS
  165.             lblInfo.Caption = LoadText("auxedit.txt")
  166.             'set the properties of the rufauxedit form
  167.             sRUFAuxTable = "EmpStatus" 'table for RufAuxEdForm
  168.             lRUFAuxEdHelpID = Auxiluary_Table_Edit_Form 'help ID for RufAuxEdForm
  169.             sRUFAuxIDCaption = "Status Number" 'ID caption for RufAuxEdForm
  170.             sRUFAuxLable = "Employee Status" 'label caption for RufAuxEdForm
  171.             sRUFAuxCaption = "Employee Statuses" 'form caption for RufAuxEdForm
  172.             sRUFAuxQuery = "GetStatusRec" 'query def for RufAuxEdForm
  173.             sRUFAuxDelCheckQuery = "CheckStatusID" 'query to check for clearence to delete a record
  174.             sRUFAuxDelQuery = "DeleteStatusID" 'query to delete a record
  175.             bRUFAuxDelete = True 'boolen value to set the enable property of cmdDelete button
  176.             sRUFAuxLoad = "GetAllStatuses" 'query def for loading the list box
  177.             sRUFAuxFields(0) = "StatusNo"
  178.             sRUFAuxFields(1) = "StatusType"
  179.             sRUFAuxFields(2) = "Active"
  180.             ModalForm RufAuxEdForm
  181.     End Select
  182. End Sub
  183. Sub fileMenu_Click (Index As Integer)
  184.     Select Case Index
  185.         Case MCLOGON
  186.             'display the logon form, collect username and password,
  187.             'validate the password
  188.             lblInfo.Caption = LoadText("login.txt")
  189.             ModalForm RufLogin
  190.             If bLogin Then
  191.                 While Not CheckPassword() And bLogin
  192.                     StopUser "Invalid login!"
  193.                     ModalForm RufLogin
  194.                     If Not bLogin Then
  195.                         'we could end the program here
  196.                         'End
  197.                     Else
  198.                     End If
  199.                 Wend
  200.             Else
  201.                 'we could end the program here also
  202.                 'End
  203.             End If
  204.         Case MCCOMPACT
  205.             lblInfo.Caption = LoadText("compact.txt")
  206.             'compact the access database file
  207.             TheDatabase.Close
  208.             DoEvents
  209.             CompactDB sDBName
  210.             OpenDB
  211.         Case MCDATABASE
  212.             lblInfo.Caption = LoadText("seldb.txt")
  213.             'select the database
  214.             'tell RufDBForm not to end the program if
  215.             'the cancel button is pressed
  216.             bRufDbEnd = False
  217.             'set the change flag to false
  218.             bDBChange = False
  219.             ModalForm RUFDBForm
  220.             'if changed close the database and open the new selection
  221.             If bDBChange Then
  222.                 DoEvents
  223.                 TheDatabase.Close
  224.                 OpenDB
  225.             End If
  226.         Case MCEXIT
  227.             'exit the program
  228.             Unload RufMain
  229.     End Select
  230. End Sub
  231. Sub Form_Load ()
  232.     On Error GoTo loaderr
  233.     Dim sWave$, sTitle$
  234.     Set MainForm = RufMain
  235.     'allow only one instance of the program to run at a time
  236.     FindProgram TheAppTitle
  237.     'set the main window title only after the FindProgram function
  238.     RufMain.Caption = TheAppTitle
  239.     RufMain.Show
  240.     'initialize the message box module
  241.     InitMB TheAppTitle
  242.     'initialize the .ini file module
  243.     InitIni TheAppTitle, "rufdemo.ini"
  244.     'initialize the help module
  245.     InitHelp "rufdemo.hlp", RufMain.hWnd
  246.     'center the form
  247.     CenterFromScreen RufMain
  248.     'get the database & path from the .ini file
  249.     sDBPath = GetFromIni("Database", 100)
  250.     'if not listed in .ini file, try the current directory
  251.     If Len(LTrim$(sDBPath)) < 1 Then
  252.         sDBPath = CurDir$ & "\" & UCase$(sDBName)
  253.     End If
  254.     'open the database
  255.     OpenDB
  256.     SetSystemDB "RufDemoSystem"
  257.     sTitle = "MIS Resources International, Inc" + Chr(10) + Chr(13)
  258.     sTitle = sTitle & "Reusable Functions Demo Program"
  259.     lblTitle.Caption = sTitle
  260.     lblInfo.Caption = LoadText("intro.txt")
  261.     If CheckCmdLine("wave") Then
  262.         sWave = CurDir$ & "\cont1.wav"
  263.         PlaySound sWave
  264.     End If
  265.     Exit Sub
  266. loaderr:
  267.     ArrowCursor
  268.     GetErrorMsg Err
  269.     Exit Sub
  270. End Sub
  271. Sub Form_Unload (cancel As Integer)
  272.     EndHelp
  273. End Sub
  274. Sub helpMenu_Click (Index As Integer)
  275.     Select Case Index
  276.         Case MCCONTENTS
  277.             lblInfo.Caption = LoadText("helptext.txt")
  278.             HelpContents
  279.         Case MCSEARCHHELP
  280.             lblInfo.Caption = LoadText("helptext.txt")
  281.             HelpSearch
  282.         Case MCABOUT
  283.             lblInfo.Caption = LoadText("about.txt")
  284.             ModalForm RUFAboutForm
  285.         'toggle registered flag: bReg
  286.         Case MCSWV
  287.             If bReg Then
  288.                 helpMenu(MCSWV).Checked = True
  289.                 bReg = False
  290.             Else
  291.                 helpMenu(MCSWV).Checked = False
  292.                 bReg = True
  293.             End If
  294.         Case MCOTHER
  295.             lblInfo.Caption = LoadText("other.txt")
  296.     End Select
  297. End Sub
  298.